package com.ruoyi.web.common;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.article.domain.TrainArticle;
import com.ruoyi.web.common.dto.SearchResult;
import com.ruoyi.web.common.service.ISearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 公共Controller
 *
 * @author 范书铭
 * @date 2024-10-13
 */
@Api("文章")
@RestController
@RequestMapping("/common/search")
public class SearchController extends BaseController {
    @Autowired
    ISearchService searchService;

    /**
     * 不区分类型搜索
     */
    @ApiOperation("不区分类型搜索,不支持分页")
    @PreAuthorize("@ss.hasPermi('common:search:list')")
    @GetMapping("/searchAll/{keyWord}")
    public AjaxResult searchAll(String keyWord) {
        List<SearchResult> list = searchService.searchAll(keyWord);
        return AjaxResult.success(list);
    }


}
